package regpang.myapplication22.statistical;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

import regpang.myapplication22.R;

public class StatisticalActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_statistical);
        RadarView radarView = findViewById(R.id.radar_view);

        //构建虚拟数据
        List<RadarView.ProjectBean> projectBeans = new ArrayList<>();

        for (int i = 0; i < 2; i++) {
            RadarView.ProjectBean projectBean = new RadarView.ProjectBean();
            if (i == 0)
                projectBean.setColor(0xFF00A8FF);
            if (i == 1)
                projectBean.setColor(0xFFFED700);
            List<Double> doubles = new ArrayList<>();
            for (int i1 = 0; i1 < 5; i1++) {
                doubles.add((1 + Math.random() * (100 - 1 + 1)));
            }
            projectBean.setValues(doubles);
            projectBeans.add(projectBean);
        }
        ArrayList<String> titles = new ArrayList();
        titles.add("能力一");
        titles.add("能力二");
        titles.add("能力三");
        titles.add("能力四");
        titles.add("能力五");

        //统计图控件使用方法
        radarView.setCount(titles.size());//设置多边形边数
        radarView.setTitles(titles);//设置标题
        radarView.setDrawMore(projectBeans.size(), projectBeans);//设置统计图绘制的数据
        radarView.refreshData();//刷新统计图
    }
}
